<?php
function randomPassword($length, $allow = "abcdefghijklmnopqrstuvwxyz0123456789"){
    $i = 1;
    $ret = NULL;
    while ($i <= $length) {
        $max  = strlen($allow)-1;
        $num  = rand(0, $max);
        $temp = substr($allow, $num, 1);
        $ret  = $ret.$temp;
        $i++;
    }
    return $ret;
}

?>
